﻿using Basic.FormGatewaryModular.Interface;
using Basic.FormRemoteModel.PageCalculate.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FormGatewaryModular.Api
{
    [ApiRouteName("/form/page/calculate/{name}")]
    internal class CalculateApi : ApiController
    {
        private readonly ICalculateService _Service;

        public CalculateApi ( ICalculateService service )
        {
            this._Service = service;
        }
        /// <summary>
        /// 图表计算
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ChartResult Chart ( CalculateArg param )
        {
            param.CompanyId = base.UserState.ToCompanyId();
            return this._Service.Chart(param);
        }
        public decimal? Statistics ( CalculateArg param )
        {
            param.CompanyId = base.UserState.ToCompanyId();
            return this._Service.Statistics(param);
        }
        public DataTableResult DataTable ( PagingParam<CalculateArg> param )
        {
            param.Query.CompanyId = base.UserState.ToCompanyId();
            return this._Service.DataTable(param);
        }
        public CensusTableResult CensusTable ( CalculateArg param )
        {
            param.CompanyId = base.UserState.ToCompanyId();
            return this._Service.CensusTable(param);
        }

    }
}
